<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>Promise</title>
</head>

<body>

	<p>Promise使用1</p>
	<p id="demo"></p>
	<script>

		function doSyn() {
			return new Promise((resolve, reject) => {
				setTimeout(() => {
					resolve("操作成功");
				}, 1000);
			});
		}

		doSyn().then(result => {
			console.log(result); 
		}).catch(error => {
			console.error(error);
		})


	</script>

</body>

</html>